package top.zhaoyuliu.logbook.server.connect.thread;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 
 * Copyright © 2021 Arain. All rights reserved.
 *
 * @Title: ThreadPool.java
 * @Prject: logbook-client
 * @Package: top.zhaoyuliu.logbook.client.thread
 * @Description: <功能详细描述>
 * @author: Arain  
 * @date: 2021年1月23日 上午11:31:28
 * @version: V1.0
 */
public enum AlarmThreadPool {

	INSTANCE;

	private static final int DEFAULT_CORE_SIZE = 100;
	private static final int MAX_QUEUE_SIZE = 500;
	private final ThreadPoolExecutor executor;

	private AlarmThreadPool() {
		executor = new ThreadPoolExecutor(DEFAULT_CORE_SIZE, // 核心线程数
				MAX_QUEUE_SIZE, // 最大线程数
				Integer.MAX_VALUE, // 闲置线程存活时间
				TimeUnit.MILLISECONDS, // 时间单位
				new LinkedBlockingDeque<Runnable>(Integer.MAX_VALUE), // 线程队列
				Executors.defaultThreadFactory()// 线程工厂
		);
	}

	public ThreadPoolExecutor executor() {
		return executor;
	}
}
